package tg.app.rj.tslx;

import java.rmi.RemoteException;
import psdi.mbo.MAXTableDomain;
import psdi.mbo.Mbo;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.mbo.MboValue;
import psdi.util.MXException;

public class FldKkswzbm extends MAXTableDomain
{
  public FldKkswzbm(MboValue mbv)
  {
    super(mbv);
    setRelationship("LOCATIONS", null);
    String[] strTo = { getMboValue().getName() };
    String[] strFrom = { "LOCATION" };
    setLookupKeyMapInOrder(strTo, strFrom);
  }

  public void action()
    throws MXException, RemoteException
  {
    if (!getMboValue().isNull()) {
      String location = getMboValue().getString();
      Mbo mbo = getMboValue().getMbo();
      if ((location != null) && (!location.equalsIgnoreCase(""))) {
        MboSetRemote assetset = mbo.getMboSet("$location", "ASSET", 
          "location='" + location + "'");
        if (!assetset.isEmpty()) {
          MboRemote assetMbo = assetset.getMbo(0);
          mbo.setValue("assetnum", assetMbo.getString("assetnum"), 
            11L);
        }
      }
    }
  }
}